Repository navigation
fix(cli): refuse blank --port/--host/--latency/--journal-max/--fixture-counts-max values - #644
Merged
Merged
Conversation
…e-counts-max values
Number("") is 0, so a blank --port bound a random port and a blank
--journal-max / --fixture-counts-max meant unbounded. A blank --host reached
listen() as "", which binds every interface instead of 127.0.0.1.
aimock-cli.ts already refuses blank values (4e3d589); mirror it in cli.ts.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A3CSud8Qn852zfCa7YofiN
commit: |
Contributor
|
Merged, thanks! Added a changelog line calling out that blank values now exit 1 instead of starting. |
Merged
jpr5
added a commit
that referenced
this pull request
Dec 1, 2026
## [1.49.0] - 2026-11-30 ### Added - Replayable seeded chaos: `--chaos-seed`/`x-aimock-chaos-seed`; journal `chaosOrigin` (#618, #653) - Recorder writes `requestHash`; stale replays get journal `staleFixture` and a warning (#640, #651) ### Changed - `aimock-pytest` 0.7.4 defaults to `@copilotkit/aimock` 1.49.0 ### Fixed - Split image turns match `userMessage` on Anthropic, Gemini (+Live), Bedrock, Cohere (#643, #648) - `llmock` now errors on blank `--port`/`--host`/`--latency`/... values instead of starting (#644)
jpr5
added a commit
that referenced
this pull request
Dec 1, 2026
**Merging this publishes @copilotkit/aimock 1.49.0 to npm and aimock-pytest 0.7.4 to PyPI.** ## [1.49.0] - 2026-11-30 ### Added - Replayable seeded chaos: `--chaos-seed`/`x-aimock-chaos-seed`; journal `chaosOrigin` (#618, #653) - Recorder writes `requestHash`; stale replays get journal `staleFixture` and a warning (#640, #651) ### Changed - `aimock-pytest` 0.7.4 defaults to `@copilotkit/aimock` 1.49.0 ### Fixed - Split image turns match `userMessage` on Anthropic, Gemini (+Live), Bedrock, Cohere (#643, #648) - `llmock` now errors on blank `--port`/`--host`/`--latency`/... values instead of starting (#644) Two new features, so this is a minor release. ## Version carriers (from `git grep -F 1.48.1`) Bumped to 1.49.0: - `package.json` version - `charts/aimock/Chart.yaml` appVersion - `.claude-plugin/plugin.json` version - `.claude-plugin/marketplace.json` source version (`^1.49.0`) - `docs/index.html` banner - `packages/aimock-pytest/README.md` `--aimock-version` default - `packages/aimock-pytest/src/aimock_pytest/_version.py` `AIMOCK_VERSION` Also bumped: `packages/aimock-pytest/pyproject.toml` 0.7.3 → 0.7.4, because the pin moved (same pattern as #628). Left as is: the `## [1.48.1]` CHANGELOG section. ## CHANGELOG edits - `## [Unreleased]` becomes `## [1.49.0] - 2026-11-30`. - Seven bullets became four, plus the aimock-pytest `Changed` line: the two #618 lines are one, #643 and #648 are one, and #651 joins the stale-fixture line. - The stale-fixture line now references PR #640 instead of issue #638. ## Docs - `docs/record-replay`: the `llmock` flag table gets `--chaos-seed` and `--chaos-keys-max`, and a note that blank `--port`/`--host`/`--latency`/`--journal-max`/`--fixture-counts-max` values are a usage error (#644). - `docs/fixtures`: the "last user message" rule now says a trailing image-only user message is skipped (#643, #648). - `README.md`: the Record & Replay line mentions stale-fixture flagging. Seeded chaos was already in the Chaos Testing line. Already covered, left alone: `docs/chaos-testing` (seeds, `x-aimock-chaos-seed`, `chaosOrigin`, `--chaos-keys-max`) and the Stale Fixtures section of `docs/record-replay` (`requestHash`, `staleFixture`, the `STALE FIXTURE` warning, `requestTransform`). The `package.json` description already matches the README subtitle. ## Local checks - `pnpm install --frozen-lockfile`, `format:check`, `lint`, `typecheck`, `build`: pass - `api:report`: 14 entries, 0 failed, no report change - `vitest run`: 503 files, 20,346 passed, 11 skipped
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
llmock(src/cli.ts) reads option values withNumber(value), andNumber("")is0. So an empty value (for example from an unset shell variable) was accepted silently:--journal-max ""and--fixture-counts-max ""became 0 (unlimited),--port ""opened a random port,--latency ""became 0,--host ""was passed tolisten()as"", which Node binds to all interfaces (::) instead of the documented127.0.0.1default. Low severity: it only happens when a blank value is passed explicitly.aimock-cli.tsalready handles this class of input (4e3d589, "refuse blank option values");cli.tsdid not get the same check.What changed
After the help check,
cli.tsexits with code 1 andError: --X requires a non-empty value.(plus help) when one of these 5 options is empty or whitespace. The check and message matchaimock-cli.ts.How it was tested
main+ the new tests:cli.test.ts10 failed / 47 passed.cli.test.ts57/57;npm run buildandnpm run lintpass; prettier clean.npm run typecheckfails with the same 8 errors on a cleanmain(openapi-catalog.test.ts, vector-stores.test.ts), unrelated to this change.npm testrun did not finish in my environment, so it is not verified here.AI disclosure
This change was found, written and tested with Claude Code (Anthropic). I'm responsible for it and happy to rework anything.
🤖 Generated with Claude Code
https://claude.ai/code/session_01A3CSud8Qn852zfCa7YofiN